#!ipxe

# Proxmox Open Source Products
# https://www.proxmox.com

goto ${menu} ||

:proxmox
clear proxmox_choice
clear proxmox_version
set os Proxmox
menu ${os}
{% for key, value in endpoints.items() | sort %}
{% if value.os == "proxmox-backup-server" %}
item --gap ${os} Backup Server
item pbs-normal ${space} ${os} Backup Server {{ value.version }}
item pbs-text ${space} ${os} Backup Server {{ value.version }} (Text)
item pbs-debug ${space} ${os} Backup Server {{ value.version }} (Debug)
{% endif %}
{% if value.os == "proxmox-mailgateway" %}
item --gap ${os} Mail Gateway
item pmg-normal ${space} ${os} Mail Gateway {{ value.version }}
item pmg-text ${space} ${os} Mail Gateway {{ value.version }} (Text)
item pmg-debug ${space} ${os} Mail Gateway {{ value.version }} (Debug)
{% endif %}
{% if value.os == "proxmox-datacenter-manager" %}
item --gap ${os} Datacenter Manager
item pdm-normal ${space} ${os} Datacenter Manager {{ value.version }}
item pdm-text ${space} ${os} Datacenter Manager {{ value.version }} (Text)
item pdm-debug ${space} ${os} Datacenter Manager {{ value.version }} (Debug)
{% endif %}
{% if value.os == "proxmox-ve" %}
item --gap ${os} VE
item pve-normal ${space} ${os} VE {{ value.version }}
item pve-text ${space} ${os} VE {{ value.version }} (Text)
item pve-debug ${space} ${os} VE {{ value.version }} (Debug)
{% endif %}
{% endfor %}
choose proxmox_choice || goto proxmox_exit
goto ${proxmox_choice}

:pdm-normal
set params splash=silent
goto boot-pdm

:pdm-text
set params splash=silent proxtui
goto boot-pdm

:pdm-debug
set params splash=verbose proxdebug
goto boot-pdm

:pve-normal
set params splash=silent
goto boot-pve

:pve-text
set params splash=silent proxtui
goto boot-pve

:pve-debug
set params splash=verbose proxdebug
goto boot-pve

:pmg-normal
set params splash=silent
goto boot-pmg

:pmg-text
set params splash=silent proxtui
goto boot-pmg

:pmg-debug
set params splash=verbose proxdebug
goto boot-pmg

:pbs-normal
set params splash=silent
goto boot-pbs

:pbs-text
set params splash=silent proxtui
goto boot-pbs

:pbs-debug
set params splash=verbose proxdebug
goto boot-pbs

:boot-pbs
{% for key, value in endpoints.items() | sort %}
{% if value.os == "proxmox-backup-server" %}
set kernel_url ${live_endpoint}{{ value.path }}
set proxmox_version {{ value.version }}
{% endif %}
{% endfor %}
imgfree
kernel ${kernel_url}vmlinuz vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 rw quiet ${params} {{ kernel_params }}
initrd ${kernel_url}initrd
initrd ${kernel_url}proxmox.iso /proxmox.iso
boot

:boot-pmg
{% for key, value in endpoints.items() | sort %}
{% if value.os == "proxmox-mailgateway" %}
set kernel_url ${live_endpoint}{{ value.path }}
set proxmox_version {{ value.version }}
{% endif %}
{% endfor %}
imgfree
kernel ${kernel_url}vmlinuz vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 rw quiet ${params} {{ kernel_params }}
initrd ${kernel_url}initrd
initrd ${kernel_url}proxmox.iso /proxmox.iso
boot

:boot-pdm
{% for key, value in endpoints.items() | sort %}
{% if value.os == "proxmox-datacenter-manager" %}
set kernel_url ${live_endpoint}{{ value.path }}
set proxmox_version {{ value.version }}
{% endif %}
{% endfor %}
imgfree
kernel ${kernel_url}vmlinuz vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 rw quiet ${params} {{ kernel_params }}
initrd ${kernel_url}initrd
initrd ${kernel_url}proxmox.iso /proxmox.iso
boot

:boot-pve
{% for key, value in endpoints.items() | sort %}
{% if value.os == "proxmox-ve" %}
set kernel_url ${live_endpoint}{{ value.path }}
set proxmox_version {{ value.version }}
{% endif %}
{% endfor %}
imgfree
kernel ${kernel_url}vmlinuz vga=791 video=vesafb:ywrap,mtrr ramdisk_size=16777216 rw quiet ${params} {{ kernel_params }}
initrd ${kernel_url}initrd
initrd ${kernel_url}proxmox.iso /proxmox.iso
boot

:proxmox_exit
clear menu
exit 0
